<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>瓜朋网Admin管理平台</title>
<link rel="stylesheet" type="text/css" href="/hdocs/admin/css/theme.css" />
<link rel="stylesheet" type="text/css" href="/hdocs/admin/css/style.css" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="/hdocs/admin/css/ie-sucks.css" />
<![endif]-->
<script type="text/javascript" src="/hdocs/jquery/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="/hdocs/admin/js/common.js"></script>
<script type="text/javascript" src="/hdocs/admin/js/admin.js"></script>
</head>
<body onload="alertMsg('$!messageCodeMap.get($!messageCode)')">
	<div id="container">
		#set ($menuIndex="topic")
		#parse("/admin/inc/header.html")
		<div id="wrapper">
			<div id="content">
				<form action="/admin/topic/subjectList.jsp">
					<a href="/admin/topic/addSubject.html" class="aadr">新建标题</a>
					<table>
						<caption>主题管理</caption>
						<tr>
							<th>标题</th>
							<td><input type="text" id="title" name="title" value="$!subject.title"/></td>
							<th>状态</th>
							<td>
								<select id="status" name="status">
									<option value="">---请选择---</option>
									<option value="0" #if($!subject.status == 0) selected #end>待发布</option>
									<option value="1" #if($!subject.status == 1) selected #end>已发布</option>
									<option value="-1" #if($!subject.status == -1) selected #end>已废弃</option>
								</select>
							</td>
							<td>
								<input type="submit" class="bt" value="查询"/>
							</td>
						</tr>
					</table>
				</form>
				<table>
					<thead>
						<tr>
							<th width="5%">ID</th>
							<th width="20%">主题</th>
							<th width="5%">状态</th>
							<th width="45%">描述</th>
							<th width="15%">更新时间</th>
							<th width="10%">操作</th>
						</tr>
					</thead>
					#foreach( $subject in $subjectList)
					<tr>
						<td>$!subject.id</td>
						<td>$!subject.title</td>
						<td>
							#if($!subject.status == 0)
							         待发布
							#elseif($!subject.status == 1)
							        已发布
							#else
							        已废弃
							#end
						</td>
						<td>$!subject.description</td>
						<td>$!subject.modifydate</td>
						<td>
							#if($!subject.status == 0)
								<a href="javascript:updateStatus($!subject.id,1);">发布</a>&nbsp;&nbsp;&nbsp;&nbsp;
								<a href="javascript:toModiSubject($!subject.id);">修改</a>
							#elseif($!subject.status == 1)
								<a href="javascript:updateStatus($!subject.id,0);">下线</a>&nbsp;&nbsp;&nbsp;&nbsp;
								<a href="javascript:toModiSubject($!subject.id);">修改</a>
							#else
							        已废弃
							#end
						</td>
					</tr>
					#end
				</table>
				<form id="toUpdateFrom" action="/admin/topic/updateInit.jsp" method="post">
					<input type="hidden" id="updateId" name="updateId" value=""/>
					<input type="hidden" name="title" value="$!subject.title"/>
					<input type="hidden" name="status" value="$!subject.status"/>
				</form>
				<form id="updateStatusFrom" action="/admin/topic/statusUpdate.jsp" method="post">
					<input type="hidden" id="updateId2" name="updateId" value=""/>
					<input type="hidden" id="updateStatus" name="updateStatus" value=""/>
					<input type="hidden" name="title" value="$!subject.title"/>
					<input type="hidden" name="status" value="$!subject.status"/>
				</form>
			</div>
			#parse("/admin/inc/sidebar.html")
		</div>
		#parse("/admin/inc/footer.html")
	</div>
</body>
</html>
<script type="text/javascript">
function toModiSubject(id){
	$("#updateId").val(id);
	$("#toUpdateFrom").submit();
}
function updateStatus(id,status){
	$("#updateId2").val(id);
	$("#updateStatus").val(status);
	$("#updateStatusFrom").submit();
}
</script>

